<?php

$conn = mysql_connect("localhost","root","");
mysql_select_db("db_sipemenang");

$response = array();
  
    $username = $_POST['username'];
	$password = $_POST['password'];
	
	$cek_login = mysql_query("SELECT * FROM agen WHERE username='$username' AND password='$password'");
	
	if(mysql_num_rows($cek_login) == 1){
	
		$r = mysql_fetch_array($cek_login);
		
		$response["hasil"] = 1;
		$response["username"] = $r["username"];
		$response["pesan"] = "Login Berhasil.";

		echo json_encode($response);
	
	}
	else{
	
		$response["hasil"] = 0;
		$response["pesan"] = "Wrong Password.";
		
		echo json_encode($response);

	}

?>